<template>
  <div class="like">
    <div class="like-title">
      <div class="liner"></div>
      <h3>猜你喜欢</h3>
      <div class="liner"></div>
    </div>
    <!-- 轮播图开始 -->
    <div class="swiper-container like-container">
      <div class="swiper-wrapper">
        <div class="swiper-slide banner">
          <div class="swiper-div">
            <a href="">
              <img src="" alt="" />
              <span class="swiper-text">小米12</span>
              <i>只要9块9</i>
              <span class="swiper-mo">全是差评</span>
              <div class="swiper-hover">加入购物车</div>
            </a>
          </div>
        </div>
      </div>
      <!-- 分页器 -->
      <div class="swiper-pagination"></div>
      <!-- 左右按钮 -->
      <!-- <div class="swiper-button-next"></div>
        <div class="swiper-button-prev"></div> -->
    </div>
    <!-- 轮播图结束 -->
  </div>
</template>

<script>
import Swiper from "swiper";

export default {
  name: "LikeSwiper",
  mounted() {
    new Swiper(".like-container", {
      // direction: 'vertical', // 垂直切换选项
      //   loop: true, // 循环模式选项
      //   autoplay: {
      //     delay: 3000,
      //     stopOnLastSlide: false,
      //     disableOnInteraction: false,
      //   },
      // 如果需要分页器
      pagination: {
        el: ".swiper-pagination",
        clickable: true,
      },

      // 如果需要前进后退按钮
      //   navigation: {
      //     nextEl: ".swiper-button-next",
      //     prevEl: ".swiper-button-prev",
      //   },

      // 如果需要滚动条
      // scrollbar: {
      //   el: ".swiper-scrollbar",
      // },
    });
  },
};
</script>

<style lang="less" scoped>
.like {
  width: 1226px;
  margin: 100px auto 0;
  .like-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    h3 {
      font-size: 30px;
      font-weight: 400;
      color: #757575;
      height: 40px;
    }
    .liner {
      width: 360px;
      height: 1px;
      background-color: #ccc;
    }
  }
}

.swiper-container {
  margin-top: 50px;
  /deep/ .swiper-div {
    display: flex;
    justify-content: space-between;
    a {
      display: flex;
      width: 234px;
      height: 300px;
      flex-direction: column;
      align-items: center;
      background-color: #fff;
      font-size: 14px;
      position: relative;
      overflow: hidden;
      img {
        margin-top: 40px;
        width: 140px;
        height: 140px;
      }
      .swiper-text {
        color: #333;
        margin: 10px 0;
      }
      i {
        color: #fe6673;
        margin-bottom: 10px;
      }
      .swiper-mo {
        color: #757575;
      }
      .swiper-hover {
        position: absolute;
        // bottom: 30px;
        bottom: -100%;
        color: #fe6673;
        border: 1px solid #fe6673;
        padding: 5px 30px;
        background-color: #fff;
        z-index: 10;
        font-size: 12px;
        opacity: 0;
        transition: all, 0.6s;
        &:hover {
          background-color: #fe6673;
          color: #fff;
        }
      }
      &:hover .swiper-hover {
        bottom: 30px;
        opacity: 1;
      }
    }
  }
}
</style>